package com.wjb.service.impl;

import com.wjb.mapper.CommentMapper;
import com.wjb.model.EbComment;
import com.wjb.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentMapper CommentMapper;

    @Override
    public List<EbComment> listByPage(int page, int pageSize) {
        int from = (page-1)*pageSize;
        return CommentMapper.findByPage(from,pageSize);
    }

    @Override
    public Integer getMaxPage(Integer pageSize) {
        return CommentMapper.getMaxPage(pageSize);
    }

    @Override
    public int delete(Integer ecId) {
        return CommentMapper.remove(ecId);
    }

    @Override
    public EbComment selectById (Integer ecId) {
        return CommentMapper.selectById(ecId) ;
    }

    @Override
    public int updateById(EbComment ebComment) {
        return CommentMapper.updateByPrimaryKey(ebComment);
    }
}
